package com.example.firstapp.KtLesson

fun main() {
    var drinkTea = DrinkTea()
    drinkTea.drink("tea")
    // 类
    var blue = BlueColor("blue")
    blue.printColor()
    var lei = lei(1)
    lei.lei1()
    // 方法
    fangfa(1)
    fangfa(2f)
}
// 接口
interface  Drink<T>{
    fun drink(t:T)
}
// 实现接口类
class DrinkTea:Drink<String>{
    // 重载
    override fun drink(t: String) {
        println("泛型接口drink:${t}")
    }
}
// 泛型类
abstract class Color<T>(val t:T){
    abstract fun printColor()
}
// 继承
class BlueColor(val color:String):Color<String>(color){
    override fun printColor() {
        println("color is ${color}")
    }
}
class lei<T>(var t:T){
    fun lei1(){
        println(t)
    }
}

fun <T> fangfa(fanxing:T){
    when(fanxing){
        is Int -> println("Int")
        is Float -> println("Float")
        else -> println("other")
    }
}
